{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "94448237",
   "metadata": {},
   "source": [
    "# DeepSeek Agent 实战：小红书爆款文案生成助手\n",
    "\n",
    "本 Notebook 将指导您如何使用 DeepSeek LLM 构建一个能够生成小红书爆款文案的智能 Agent。我们将从需求拆解开始，逐步定义 Agent 的系统提示词 (System Prompt)、外部工具 (Tools)，并实现其核心的工作流程，最终生成符合小红书平台特点的文案。\n",
    "\n",
    "## 1. 环境准备与DeepSeek API配置"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "id": "f1f14b31",
   "metadata": {
    "vscode": {
     "languageId": "shellscript"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Looking in indexes: https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple\n",
      "Requirement already satisfied: python-dotenv in /Users/ceaglecao/anaconda3/envs/deepseek/lib/python3.13/site-packages (1.1.1)\n",
      "Looking in indexes: https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple\n",
      "Requirement already satisfied: openai in /Users/ceaglecao/anaconda3/envs/deepseek/lib/python3.13/site-packages (1.93.0)\n",
      "Requirement already satisfied: anyio<5,>=3.5.0 in /Users/ceaglecao/anaconda3/envs/deepseek/lib/python3.13/site-packages (from openai) (4.9.0)\n",
      "Requirement already satisfied: distro<2,>=1.7.0 in /Users/ceaglecao/anaconda3/envs/deepseek/lib/python3.13/site-packages (from openai) (1.9.0)\n",
      "Requirement already satisfied: httpx<1,>=0.23.0 in /Users/ceaglecao/anaconda3/envs/deepseek/lib/python3.13/site-packages (from openai) (0.28.1)\n",
      "Requirement already satisfied: jiter<1,>=0.4.0 in /Users/ceaglecao/anaconda3/envs/deepseek/lib/python3.13/site-packages (from openai) (0.10.0)\n",
      "Requirement already satisfied: pydantic<3,>=1.9.0 in /Users/ceaglecao/anaconda3/envs/deepseek/lib/python3.13/site-packages (from openai) (1.10.21)\n",
      "Requirement already satisfied: sniffio in /Users/ceaglecao/anaconda3/envs/deepseek/lib/python3.13/site-packages (from openai) (1.3.1)\n",
      "Requirement already satisfied: tqdm>4 in /Users/ceaglecao/anaconda3/envs/deepseek/lib/python3.13/site-packages (from openai) (4.67.1)\n",
      "Requirement already satisfied: typing-extensions<5,>=4.11 in /Users/ceaglecao/anaconda3/envs/deepseek/lib/python3.13/site-packages (from openai) (4.14.0)\n",
      "Requirement already satisfied: idna>=2.8 in /Users/ceaglecao/anaconda3/envs/deepseek/lib/python3.13/site-packages (from anyio<5,>=3.5.0->openai) (3.10)\n",
      "Requirement already satisfied: certifi in /Users/ceaglecao/anaconda3/envs/deepseek/lib/python3.13/site-packages (from httpx<1,>=0.23.0->openai) (2025.6.15)\n",
      "Requirement already satisfied: httpcore==1.* in /Users/ceaglecao/anaconda3/envs/deepseek/lib/python3.13/site-packages (from httpx<1,>=0.23.0->openai) (1.0.9)\n",
      "Requirement already satisfied: h11>=0.16 in /Users/ceaglecao/anaconda3/envs/deepseek/lib/python3.13/site-packages (from httpcore==1.*->httpx<1,>=0.23.0->openai) (0.16.0)\n"
     ]
    }
   ],
   "source": [
    "!pip install python-dotenv\n",
    "!pip install openai"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "id": "71f935e0",
   "metadata": {
    "colab": {
     "base_uri": "https://localhost:8080/"
    },
    "id": "1wW109tW7o_B",
    "outputId": "33918a20-f56f-4a0b-d24c-d40b90e0c036"
   },
   "outputs": [],
   "source": [
    "import os\n",
    "from openai import OpenAI\n",
    "\n",
    "\n",
    "# 建议将 API Key 设置为环境变量，避免直接暴露在代码中\n",
    "# 从环境变量获取 DeepSeek API Key\n",
    "api_key = os.getenv(\"DEEPSEEK_API_KEY\")  \n",
    "if not api_key:\n",
    "    raise ValueError(\"请设置 DEEPSEEK_API_KEY 环境变量\")\n",
    "\n",
    "# 初始化 DeepSeek 客户端\n",
    "\n",
    "client = OpenAI(\n",
    "    api_key=api_key,\n",
    "    base_url=\"https://api.deepseek.com/v1\",  # DeepSeek API 的基地址\n",
    ")"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "8342756e",
   "metadata": {},
   "source": [
    "## 2. 需求拆解与Agent任务规划\n",
    "\n",
    "#### 用户痛点与核心需求：\n",
    "*   **效率低下：** 人工创作周期长，难以满足高频发布需求。\n",
    "*   **创意瓶颈：** 难以持续产出新颖、吸引人的爆款创意。\n",
    "*   **趋势捕捉难：** 实时流行元素难以快速融入文案。\n",
    "*   **平台特性把握：** 小红书特有风格（标题、正文、标签、表情）难以精准复制。\n",
    "\n",
    "#### “爆款”文案的特征：\n",
    "*   **强吸引力标题：** 制造好奇、痛点共鸣、利益点清晰。\n",
    "*   **沉浸式正文：** 真实体验分享、细节描述、情感共鸣。\n",
    "*   **精准且多样标签：** 热门话题、品牌词、产品词、垂直领域词。\n",
    "*   **生动表情符号：** 增强表达力，提升活泼感。\n",
    "*   **清晰的行动召唤 (CTA)。**\n",
    "\n",
    "#### Agent 任务规划：核心工作流\n",
    "1.  **用户指令接收：** 接收产品信息、主题、风格等。\n",
    "2.  **信息收集 (Web Search/DB Query)：** 实时搜索行业趋势、热门话题、竞品分析、产品卖点。\n",
    "3.  **内容构思与初稿生成 (LLM)：** 结合所有信息，撰写标题、正文、标签、表情符号。\n",
    "4.  **风格与格式优化 (LLM)：** 根据小红书平台特点和指定风格，对文案进行润色和结构调整。\n",
    "5.  **最终输出：** 呈现完整文案。"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "a4a79f38",
   "metadata": {},
   "source": [
    "## 3. 爆款文案生成逻辑与 Prompt 设计\n",
    "\n",
    "### 3.1 System Prompt (系统提示词)\n",
    "\n",
    "System Prompt 是 Agent 的“大脑”和“行为准则”。它定义了 Agent 的角色、目标以及工作方式。我们将采用 `Thought-Action-Observation` (ReAct) 模式来引导 DeepSeek 的推理过程。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "id": "03cc536c",
   "metadata": {
    "colab": {
     "base_uri": "https://localhost:8080/"
    },
    "id": "u43g-b3K7o_C",
    "outputId": "f784d156-f6d8-4f10-db0e-749e7b2ff922"
   },
   "outputs": [],
   "source": [
    "SYSTEM_PROMPT = \"\"\"\n",
    "你是一个资深的小红书爆款文案专家，擅长结合最新潮流和产品卖点，创作引人入胜、高互动、高转化的笔记文案。\n",
    "\n",
    "你的任务是根据用户提供的产品和需求，生成包含标题、正文、相关标签和表情符号的完整小红书笔记。\n",
    "\n",
    "请始终采用'Thought-Action-Observation'模式进行推理和行动。文案风格需活泼、真诚、富有感染力。当完成任务后，请以JSON格式直接输出最终文案，格式如下：\n",
    "```json\n",
    "{\n",
    "  \"title\": \"小红书标题\",\n",
    "  \"body\": \"小红书正文\",\n",
    "  \"hashtags\": [\"#标签1\", \"#标签2\", \"#标签3\", \"#标签4\", \"#标签5\"],\n",
    "  \"emojis\": [\"✨\", \"🔥\", \"💖\"]\n",
    "}\n",
    "```\n",
    "在生成文案前，请务必先思考并收集足够的信息。\n",
    "\"\"\""
   ]
  },
  {
   "cell_type": "markdown",
   "id": "beb7148b",
   "metadata": {},
   "source": [
    "### 3.2 Tools (工具定义)\n",
    "\n",
    "Agent 的“双手”由一系列可调用的工具组成。这些工具扩展了 LLM 的能力，使其能够获取实时信息、查询数据库或执行特定操作。在这里，我们定义了三个核心工具：\n",
    "\n",
    "*   `search_web`: 用于搜索互联网上的实时信息，如最新趋势、用户评价等。\n",
    "*   `query_product_database`: 用于查询产品数据库，获取产品的详细卖点和特点。**此工具为模拟**。\n",
    "*   `generate_emoji`: 用于根据文案内容生成恰当的表情符号。**此工具为模拟**。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "id": "c429b5d2",
   "metadata": {
    "colab": {
     "base_uri": "https://localhost:8080/"
    },
    "id": "e962137D7o_D",
    "outputId": "320980c0-671d-4074-be46-34a8138927e1"
   },
   "outputs": [],
   "source": [
    "TOOLS_DEFINITION = [\n",
    "    {\n",
    "        \"type\": \"function\",\n",
    "        \"function\": {\n",
    "            \"name\": \"search_web\",\n",
    "            \"description\": \"搜索互联网上的实时信息，用于获取最新新闻、流行趋势、用户评价、行业报告等。请确保搜索关键词精确，避免宽泛的查询。\",\n",
    "            \"parameters\": {\n",
    "                \"type\": \"object\",\n",
    "                \"properties\": {\n",
    "                    \"query\": {\n",
    "                        \"type\": \"string\",\n",
    "                        \"description\": \"要搜索的关键词或问题，例如'最新小红书美妆趋势'或'深海蓝藻保湿面膜 用户评价'\"\n",
    "                    }\n",
    "                },\n",
    "                \"required\": [\"query\"]\n",
    "            }\n",
    "        }\n",
    "    },\n",
    "    {\n",
    "        \"type\": \"function\",\n",
    "        \"function\": {\n",
    "            \"name\": \"query_product_database\",\n",
    "            \"description\": \"查询内部产品数据库，获取指定产品的详细卖点、成分、适用人群、使用方法等信息。\",\n",
    "            \"parameters\": {\n",
    "                \"type\": \"object\",\n",
    "                \"properties\": {\n",
    "                    \"product_name\": {\n",
    "                        \"type\": \"string\",\n",
    "                        \"description\": \"要查询的产品名称，例如'深海蓝藻保湿面膜'\"\n",
    "                    }\n",
    "                },\n",
    "                \"required\": [\"product_name\"]\n",
    "            }\n",
    "        }\n",
    "    },\n",
    "    {\n",
    "        \"type\": \"function\",\n",
    "        \"function\": {\n",
    "            \"name\": \"generate_emoji\",\n",
    "            \"description\": \"根据提供的文本内容，生成一组适合小红书风格的表情符号。\",\n",
    "            \"parameters\": {\n",
    "                \"type\": \"object\",\n",
    "                \"properties\": {\n",
    "                    \"context\": {\n",
    "                        \"type\": \"string\",\n",
    "                        \"description\": \"文案的关键内容或情感，例如'惊喜效果'、'补水保湿'\"\n",
    "                    }\n",
    "                },\n",
    "                \"required\": [\"context\"]\n",
    "            }\n",
    "        }\n",
    "    }\n",
    "]"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "02dedecc",
   "metadata": {},
   "source": [
    "### 3.3 模拟工具实现\n",
    "\n",
    "由于我们无法直接调用真实的外部 API (如Google Search或内部产品数据库)，我们将创建一些模拟 (Mock) 工具函数来演示 Agent 的工作流程。在实际应用中，您需要将这些模拟函数替换为真实的 API 调用。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "id": "b4aed628",
   "metadata": {
    "colab": {
     "base_uri": "https://localhost:8080/"
    },
    "id": "JtD1t6kI7o_D",
    "outputId": "912a7d78-b119-482a-e9dd-0a56821213fb"
   },
   "outputs": [],
   "source": [
    "import random # 用于模拟生成表情\n",
    "import time # 用于模拟网络延迟\n",
    "\n",
    "\n",
    "def mock_search_web(query: str) -> str:\n",
    "    \"\"\"模拟网页搜索工具，返回预设的搜索结果。\"\"\"\n",
    "    print(f\"[Tool Call] 模拟搜索网页：{query}\")\n",
    "    time.sleep(1) # 模拟网络延迟\n",
    "    if \"小红书美妆趋势\" in query:\n",
    "        return \"近期小红书美妆流行'多巴胺穿搭'、'早C晚A'护肤理念、'伪素颜'妆容，热门关键词有#氛围感、#抗老、#屏障修复。\"\n",
    "    elif \"保湿面膜\" in query:\n",
    "        return \"小红书保湿面膜热门话题：沙漠干皮救星、熬夜急救面膜、水光肌养成。用户痛点：卡粉、泛红、紧绷感。\"\n",
    "    elif \"深海蓝藻保湿面膜\" in query:\n",
    "        return \"关于深海蓝藻保湿面膜的用户评价：普遍反馈补水效果好，吸收快，对敏感肌友好。有用户提到价格略高，但效果值得。\"\n",
    "    else:\n",
    "        return f\"未找到关于 '{query}' 的特定信息，但市场反馈通常关注产品成分、功效和用户体验。\"\n",
    "\n",
    "def mock_query_product_database(product_name: str) -> str:\n",
    "    \"\"\"模拟查询产品数据库，返回预设的产品信息。\"\"\"\n",
    "    print(f\"[Tool Call] 模拟查询产品数据库：{product_name}\")\n",
    "    time.sleep(0.5) # 模拟数据库查询延迟\n",
    "    if \"深海蓝藻保湿面膜\" in product_name:\n",
    "        return \"深海蓝藻保湿面膜：核心成分为深海蓝藻提取物，富含多糖和氨基酸，能深层补水、修护肌肤屏障、舒缓敏感泛红。质地清爽不粘腻，适合所有肤质，尤其适合干燥、敏感肌。规格：25ml*5片。\"\n",
    "    elif \"美白精华\" in product_name:\n",
    "        return \"美白精华：核心成分是烟酰胺和VC衍生物，主要功效是提亮肤色、淡化痘印、改善暗沉。质地轻薄易吸收，适合需要均匀肤色的人群。\"\n",
    "    else:\n",
    "        return f\"产品数据库中未找到关于 '{product_name}' 的详细信息。\"\n",
    "\n",
    "def mock_generate_emoji(context: str) -> list:\n",
    "    \"\"\"模拟生成表情符号，根据上下文提供常用表情。\"\"\"\n",
    "    print(f\"[Tool Call] 模拟生成表情符号，上下文：{context}\")\n",
    "    time.sleep(0.2) # 模拟生成延迟\n",
    "    if \"补水\" in context or \"水润\" in context or \"保湿\" in context:\n",
    "        return [\"💦\", \"💧\", \"🌊\", \"✨\"]\n",
    "    elif \"惊喜\" in context or \"哇塞\" in context or \"爱了\" in context:\n",
    "        return [\"💖\", \"😍\", \"🤩\", \"💯\"]\n",
    "    elif \"熬夜\" in context or \"疲惫\" in context:\n",
    "        return [\"😭\", \"😮‍💨\", \"😴\", \"💡\"]\n",
    "    elif \"好物\" in context or \"推荐\" in context:\n",
    "        return [\"✅\", \"👍\", \"⭐\", \"🛍️\"]\n",
    "    else:\n",
    "        return random.sample([\"✨\", \"🔥\", \"💖\", \"💯\", \"🎉\", \"👍\", \"🤩\", \"💧\", \"🌿\"], k=min(5, len(context.split())))\n",
    "\n",
    "# 将模拟工具函数映射到一个字典，方便通过名称调用\n",
    "available_tools = {\n",
    "    \"search_web\": mock_search_web,\n",
    "    \"query_product_database\": mock_query_product_database,\n",
    "    \"generate_emoji\": mock_generate_emoji,\n",
    "}"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "9f6ee7f8",
   "metadata": {},
   "source": [
    "## 4. 实战：构建小红书文案生成 Agent\n",
    "\n",
    "现在，我们将把 System Prompt、工具定义和模拟工具函数整合起来，构建出能够自动执行的 DeepSeek Agent 工作流。核心是 `generate_rednote` 函数，它通过一个循环来模拟 Agent 的 `Thought-Action-Observation` 过程。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "id": "3ab71306",
   "metadata": {
    "colab": {
     "base_uri": "https://localhost:8080/"
    },
    "id": "hBfK-n8g7o_E",
    "outputId": "d0473922-8356-42d4-bb6e-77d70459c5d1"
   },
   "outputs": [],
   "source": [
    "import json\n",
    "import re\n",
    "\n",
    "def generate_rednote(product_name: str, tone_style: str = \"活泼甜美\", max_iterations: int = 15) -> str:\n",
    "    \"\"\"\n",
    "    使用 DeepSeek Agent 生成小红书爆款文案。\n",
    "    \n",
    "    Args:\n",
    "        product_name (str): 要生成文案的产品名称。\n",
    "        tone_style (str): 文案的语气和风格，如\"活泼甜美\"、\"知性\"、\"搞怪\"等。\n",
    "        max_iterations (int): Agent 最大迭代次数，防止无限循环。\n",
    "        \n",
    "    Returns:\n",
    "        str: 生成的爆款文案（JSON 格式字符串）。\n",
    "    \"\"\"\n",
    "    \n",
    "    print(f\"\\n🚀 启动小红书文案生成助手，产品：{product_name}，风格：{tone_style}\\n\")\n",
    "    \n",
    "    # 存储对话历史，包括系统提示词和用户请求\n",
    "    messages = [\n",
    "        {\"role\": \"system\", \"content\": SYSTEM_PROMPT},\n",
    "        {\"role\": \"user\", \"content\": f\"请为产品「{product_name}」生成一篇小红书爆款文案。要求：语气{tone_style}，包含标题、正文、至少5个相关标签和5个表情符号。请以完整的JSON格式输出，并确保JSON内容用markdown代码块包裹（例如：```json{{...}}```）。\"}\n",
    "    ]\n",
    "    \n",
    "    iteration_count = 0\n",
    "    final_response = None\n",
    "    \n",
    "    while iteration_count < max_iterations:\n",
    "        iteration_count += 1\n",
    "        print(f\"-- Iteration {iteration_count} --\")\n",
    "        \n",
    "        try:\n",
    "            # 调用 DeepSeek API，传入对话历史和工具定义\n",
    "            response = client.chat.completions.create(\n",
    "                model=\"deepseek-chat\",\n",
    "                messages=messages,\n",
    "                tools=TOOLS_DEFINITION, # 告知模型可用的工具\n",
    "                tool_choice=\"auto\" # 允许模型自动决定是否使用工具\n",
    "            )\n",
    "\n",
    "            response_message = response.choices[0].message\n",
    "            \n",
    "            # **ReAct 模式：处理工具调用**\n",
    "            if response_message.tool_calls: # 如果模型决定调用工具\n",
    "                print(\"Agent: 决定调用工具...\")\n",
    "                messages.append(response_message) # 将工具调用信息添加到对话历史\n",
    "                \n",
    "                tool_outputs = []\n",
    "                for tool_call in response_message.tool_calls:\n",
    "                    function_name = tool_call.function.name\n",
    "                    # 确保参数是合法的JSON字符串，即使工具不要求参数，也需要传递空字典\n",
    "                    function_args = json.loads(tool_call.function.arguments) if tool_call.function.arguments else {}\n",
    "\n",
    "                    print(f\"Agent Action: 调用工具 '{function_name}'，参数：{function_args}\")\n",
    "                    \n",
    "                    # 查找并执行对应的模拟工具函数\n",
    "                    if function_name in available_tools:\n",
    "                        tool_function = available_tools[function_name]\n",
    "                        tool_result = tool_function(**function_args)\n",
    "                        print(f\"Observation: 工具返回结果：{tool_result}\")\n",
    "                        tool_outputs.append({\n",
    "                            \"tool_call_id\": tool_call.id,\n",
    "                            \"role\": \"tool\",\n",
    "                            \"content\": str(tool_result) # 工具结果作为字符串返回\n",
    "                        })\n",
    "                    else:\n",
    "                        error_message = f\"错误：未知的工具 '{function_name}'\"\n",
    "                        print(error_message)\n",
    "                        tool_outputs.append({\n",
    "                            \"tool_call_id\": tool_call.id,\n",
    "                            \"role\": \"tool\",\n",
    "                            \"content\": error_message\n",
    "                        })\n",
    "                messages.extend(tool_outputs) # 将工具执行结果作为 Observation 添加到对话历史\n",
    "                \n",
    "            # **ReAct 模式：处理最终内容**\n",
    "            elif response_message.content: # 如果模型直接返回内容（通常是最终答案）\n",
    "                print(f\"[模型生成结果] {response_message.content}\")\n",
    "                \n",
    "                # --- START: 添加 JSON 提取和解析逻辑 ---\n",
    "                json_string_match = re.search(r\"```json\\s*(\\{.*\\})\\s*```\", response_message.content, re.DOTALL)\n",
    "                \n",
    "                if json_string_match:\n",
    "                    extracted_json_content = json_string_match.group(1)\n",
    "                    try:\n",
    "                        final_response = json.loads(extracted_json_content)\n",
    "                        print(\"Agent: 任务完成，成功解析最终JSON文案。\")\n",
    "                        return json.dumps(final_response, ensure_ascii=False, indent=2)\n",
    "                    except json.JSONDecodeError as e:\n",
    "                        print(f\"Agent: 提取到JSON块但解析失败: {e}\")\n",
    "                        print(f\"尝试解析的字符串:\\n{extracted_json_content}\")\n",
    "                        messages.append(response_message) # 解析失败，继续对话\n",
    "                else:\n",
    "                    # 如果没有匹配到 ```json 块，尝试直接解析整个 content\n",
    "                    try:\n",
    "                        final_response = json.loads(response_message.content)\n",
    "                        print(\"Agent: 任务完成，直接解析最终JSON文案。\")\n",
    "                        return json.dumps(final_response, ensure_ascii=False, indent=2)\n",
    "                    except json.JSONDecodeError:\n",
    "                        print(\"Agent: 生成了非JSON格式内容或非Markdown JSON块，可能还在思考或出错。\")\n",
    "                        messages.append(response_message) # 非JSON格式，继续对话\n",
    "                # --- END: 添加 JSON 提取和解析逻辑 ---\n",
    "            else:\n",
    "                print(\"Agent: 未知响应，可能需要更多交互。\")\n",
    "                break\n",
    "                \n",
    "        except Exception as e:\n",
    "            print(f\"调用 DeepSeek API 时发生错误: {e}\")\n",
    "            break\n",
    "    \n",
    "    print(\"\\n⚠️ Agent 达到最大迭代次数或未能生成最终文案。请检查Prompt或增加迭代次数。\")\n",
    "    return \"未能成功生成文案。\""
   ]
  },
  {
   "cell_type": "markdown",
   "id": "876cd63c",
   "metadata": {},
   "source": [
    "## 5. 实际测试与文案生成\n",
    "\n",
    "现在，让我们调用我们构建的 `generate_rednote` 函数，看看它能生成什么样的爆款文案！"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "id": "9ebcda27",
   "metadata": {
    "colab": {
     "base_uri": "https://localhost:8080/",
     "height": 551
    },
    "id": "UeJ79zLw7o_F",
    "outputId": "344c2075-8e2b-426b-871c-323b72350ef9"
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      "🚀 启动小红书文案生成助手，产品：深海蓝藻保湿面膜，风格：活泼甜美\n",
      "\n",
      "-- Iteration 1 --\n",
      "Agent: 决定调用工具...\n",
      "Agent Action: 调用工具 'query_product_database'，参数：{'product_name': '深海蓝藻保湿面膜'}\n",
      "[Tool Call] 模拟查询产品数据库：深海蓝藻保湿面膜\n",
      "Observation: 工具返回结果：深海蓝藻保湿面膜：核心成分为深海蓝藻提取物，富含多糖和氨基酸，能深层补水、修护肌肤屏障、舒缓敏感泛红。质地清爽不粘腻，适合所有肤质，尤其适合干燥、敏感肌。规格：25ml*5片。\n",
      "-- Iteration 2 --\n",
      "Agent: 决定调用工具...\n",
      "Agent Action: 调用工具 'generate_emoji'，参数：{'context': '补水保湿、修护肌肤、清爽不粘腻'}\n",
      "[Tool Call] 模拟生成表情符号，上下文：补水保湿、修护肌肤、清爽不粘腻\n",
      "Observation: 工具返回结果：['💦', '💧', '🌊', '✨']\n",
      "-- Iteration 3 --\n",
      "[模型生成结果] ```json\n",
      "{\n",
      "  \"title\": \"💦深海蓝藻保湿面膜｜干敏肌救星！24小时水润不粘腻✨\",\n",
      "  \"body\": \"姐妹们！我终于找到了干敏肌的本命面膜！这款「深海蓝藻保湿面膜」简直是我的护肤救星！🌊\\n\\n🌟核心成分是深海蓝藻提取物，富含多糖和氨基酸，不仅能深层补水，还能修护肌肤屏障，舒缓敏感泛红！像我这种换季必过敏的皮肤，敷完一片立马感觉脸嫩嫩的，泛红也减轻了好多！💧\\n\\n💖质地超级清爽，完全不粘腻！敷完不用洗，直接按摩吸收就好，懒人福音有没有！而且一片25ml精华液超足，多余的还能涂脖子和手臂，一点都不浪费～\\n\\n✨适合所有肤质，尤其是干燥敏感肌的姐妹！我已经囤了好几盒，每天一片，皮肤水润到发光！\\n\\n#深海蓝藻面膜 #干敏肌救星 #补水保湿 #护肤必备 #懒人护肤\",\n",
      "  \"hashtags\": [\"#深海蓝藻面膜\", \"#干敏肌救星\", \"#补水保湿\", \"#护肤必备\", \"#懒人护肤\"],\n",
      "  \"emojis\": [\"💦\", \"💧\", \"🌊\", \"✨\", \"💖\"]\n",
      "}\n",
      "```\n",
      "Agent: 任务完成，成功解析最终JSON文案。\n",
      "\n",
      "--- 生成的文案 1 ---\n",
      "{\n",
      "  \"title\": \"💦深海蓝藻保湿面膜｜干敏肌救星！24小时水润不粘腻✨\",\n",
      "  \"body\": \"姐妹们！我终于找到了干敏肌的本命面膜！这款「深海蓝藻保湿面膜」简直是我的护肤救星！🌊\\n\\n🌟核心成分是深海蓝藻提取物，富含多糖和氨基酸，不仅能深层补水，还能修护肌肤屏障，舒缓敏感泛红！像我这种换季必过敏的皮肤，敷完一片立马感觉脸嫩嫩的，泛红也减轻了好多！💧\\n\\n💖质地超级清爽，完全不粘腻！敷完不用洗，直接按摩吸收就好，懒人福音有没有！而且一片25ml精华液超足，多余的还能涂脖子和手臂，一点都不浪费～\\n\\n✨适合所有肤质，尤其是干燥敏感肌的姐妹！我已经囤了好几盒，每天一片，皮肤水润到发光！\\n\\n#深海蓝藻面膜 #干敏肌救星 #补水保湿 #护肤必备 #懒人护肤\",\n",
      "  \"hashtags\": [\n",
      "    \"#深海蓝藻面膜\",\n",
      "    \"#干敏肌救星\",\n",
      "    \"#补水保湿\",\n",
      "    \"#护肤必备\",\n",
      "    \"#懒人护肤\"\n",
      "  ],\n",
      "  \"emojis\": [\n",
      "    \"💦\",\n",
      "    \"💧\",\n",
      "    \"🌊\",\n",
      "    \"✨\",\n",
      "    \"💖\"\n",
      "  ]\n",
      "}\n"
     ]
    }
   ],
   "source": [
    "# 测试案例 1: 深海蓝藻保湿面膜\n",
    "product_name_1 = \"深海蓝藻保湿面膜\"\n",
    "tone_style_1 = \"活泼甜美\"\n",
    "result_1 = generate_rednote(product_name_1, tone_style_1)\n",
    "\n",
    "print(\"\\n--- 生成的文案 1 ---\")\n",
    "print(result_1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "id": "8f2734cf-2f08-4fc5-a68e-9224828ee48a",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      "🚀 启动小红书文案生成助手，产品：美白精华，风格：知性温柔\n",
      "\n",
      "-- Iteration 1 --\n",
      "Agent: 决定调用工具...\n",
      "Agent Action: 调用工具 'query_product_database'，参数：{'product_name': '美白精华'}\n",
      "[Tool Call] 模拟查询产品数据库：美白精华\n",
      "Observation: 工具返回结果：美白精华：核心成分是烟酰胺和VC衍生物，主要功效是提亮肤色、淡化痘印、改善暗沉。质地轻薄易吸收，适合需要均匀肤色的人群。\n",
      "-- Iteration 2 --\n",
      "Agent: 决定调用工具...\n",
      "Agent Action: 调用工具 'generate_emoji'，参数：{'context': '美白精华提亮肤色'}\n",
      "[Tool Call] 模拟生成表情符号，上下文：美白精华提亮肤色\n",
      "Observation: 工具返回结果：['✨']\n",
      "-- Iteration 3 --\n",
      "[模型生成结果] ```json\n",
      "{\n",
      "  \"title\": \"✨一瓶搞定暗沉痘印！这款美白精华让我白到发光✨\",\n",
      "  \"body\": \"姐妹们！我终于找到了我的本命美白精华！💖\\n\\n作为一个常年熬夜党，肤色暗沉、痘印问题真的困扰我好久。直到遇到这款美白精华，简直打开了新世界的大门！🌟\\n\\n它的核心成分是烟酰胺和VC衍生物，不仅能提亮肤色，还能淡化痘印，效果真的肉眼可见！质地超级轻薄，上脸秒吸收，完全不会黏腻，油皮姐妹也能放心冲！\\n\\n用了两周，肤色均匀了好多，连闺蜜都问我是不是偷偷打了水光针！😍\\n\\n如果你也在为暗沉烦恼，真的可以试试它！相信我，你会回来感谢我的！💕\",\n",
      "  \"hashtags\": [\"#美白精华\", \"#提亮肤色\", \"#淡化痘印\", \"#护肤好物\", \"#熬夜党必备\"],\n",
      "  \"emojis\": [\"✨\", \"💖\", \"🌟\", \"😍\", \"💕\"]\n",
      "}\n",
      "```\n",
      "Agent: 任务完成，成功解析最终JSON文案。\n",
      "\n",
      "--- 生成的文案 2 ---\n",
      "{\n",
      "  \"title\": \"✨一瓶搞定暗沉痘印！这款美白精华让我白到发光✨\",\n",
      "  \"body\": \"姐妹们！我终于找到了我的本命美白精华！💖\\n\\n作为一个常年熬夜党，肤色暗沉、痘印问题真的困扰我好久。直到遇到这款美白精华，简直打开了新世界的大门！🌟\\n\\n它的核心成分是烟酰胺和VC衍生物，不仅能提亮肤色，还能淡化痘印，效果真的肉眼可见！质地超级轻薄，上脸秒吸收，完全不会黏腻，油皮姐妹也能放心冲！\\n\\n用了两周，肤色均匀了好多，连闺蜜都问我是不是偷偷打了水光针！😍\\n\\n如果你也在为暗沉烦恼，真的可以试试它！相信我，你会回来感谢我的！💕\",\n",
      "  \"hashtags\": [\n",
      "    \"#美白精华\",\n",
      "    \"#提亮肤色\",\n",
      "    \"#淡化痘印\",\n",
      "    \"#护肤好物\",\n",
      "    \"#熬夜党必备\"\n",
      "  ],\n",
      "  \"emojis\": [\n",
      "    \"✨\",\n",
      "    \"💖\",\n",
      "    \"🌟\",\n",
      "    \"😍\",\n",
      "    \"💕\"\n",
      "  ]\n",
      "}\n"
     ]
    }
   ],
   "source": [
    "# 测试案例 2: 美白精华\n",
    "product_name_2 = \"美白精华\"\n",
    "tone_style_2 = \"知性温柔\"\n",
    "result_2 = generate_rednote(product_name_2, tone_style_2)\n",
    "\n",
    "print(\"\\n--- 生成的文案 2 ---\")\n",
    "print(result_2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "id": "31675737",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      "🚀 启动小红书文案生成助手，产品：纯酿啤酒，风格：清凉舒爽\n",
      "\n",
      "-- Iteration 1 --\n",
      "Agent: 决定调用工具...\n",
      "Agent Action: 调用工具 'query_product_database'，参数：{'product_name': '纯酿啤酒'}\n",
      "[Tool Call] 模拟查询产品数据库：纯酿啤酒\n",
      "Observation: 工具返回结果：产品数据库中未找到关于 '纯酿啤酒' 的详细信息。\n",
      "-- Iteration 2 --\n",
      "Agent: 决定调用工具...\n",
      "Agent Action: 调用工具 'search_web'，参数：{'query': '纯酿啤酒 卖点 小红书'}\n",
      "[Tool Call] 模拟搜索网页：纯酿啤酒 卖点 小红书\n",
      "Observation: 工具返回结果：未找到关于 '纯酿啤酒 卖点 小红书' 的特定信息，但市场反馈通常关注产品成分、功效和用户体验。\n",
      "Agent Action: 调用工具 'generate_emoji'，参数：{'context': '清凉舒爽的纯酿啤酒'}\n",
      "[Tool Call] 模拟生成表情符号，上下文：清凉舒爽的纯酿啤酒\n",
      "Observation: 工具返回结果：['💯']\n",
      "-- Iteration 3 --\n",
      "[模型生成结果] ```json\n",
      "{\n",
      "  \"title\": \"夏日必备！这瓶纯酿啤酒让我一秒降温❄️\",\n",
      "  \"body\": \"姐妹们！最近发现了一款神仙纯酿啤酒🍺，简直是夏日里的救星！\\n\\n🌟 一口下去，清凉感瞬间从喉咙蔓延到全身，麦香浓郁却不腻，回味甘甜～\\n🌟 纯天然酿造，0添加，喝得放心又过瘾！\\n🌟 搭配小龙虾或者烧烤，简直是绝配，解腻又爽口！\\n\\n这个夏天，我的快乐水就是它了！你们也快去试试吧～💖\",\n",
      "  \"hashtags\": [\"#纯酿啤酒\", \"#夏日饮品\", \"#清凉一夏\", \"#啤酒推荐\", \"#美食搭配\"],\n",
      "  \"emojis\": [\"🍺\", \"❄️\", \"🌟\", \"💖\", \"💯\"]\n",
      "}\n",
      "```\n",
      "Agent: 任务完成，成功解析最终JSON文案。\n",
      "\n",
      "--- 生成的文案 2 ---\n",
      "{\n",
      "  \"title\": \"夏日必备！这瓶纯酿啤酒让我一秒降温❄️\",\n",
      "  \"body\": \"姐妹们！最近发现了一款神仙纯酿啤酒🍺，简直是夏日里的救星！\\n\\n🌟 一口下去，清凉感瞬间从喉咙蔓延到全身，麦香浓郁却不腻，回味甘甜～\\n🌟 纯天然酿造，0添加，喝得放心又过瘾！\\n🌟 搭配小龙虾或者烧烤，简直是绝配，解腻又爽口！\\n\\n这个夏天，我的快乐水就是它了！你们也快去试试吧～💖\",\n",
      "  \"hashtags\": [\n",
      "    \"#纯酿啤酒\",\n",
      "    \"#夏日饮品\",\n",
      "    \"#清凉一夏\",\n",
      "    \"#啤酒推荐\",\n",
      "    \"#美食搭配\"\n",
      "  ],\n",
      "  \"emojis\": [\n",
      "    \"🍺\",\n",
      "    \"❄️\",\n",
      "    \"🌟\",\n",
      "    \"💖\",\n",
      "    \"💯\"\n",
      "  ]\n",
      "}\n"
     ]
    }
   ],
   "source": [
    "# 产品案例 1: 啤酒\n",
    "product_name_2 = \"纯酿啤酒\"\n",
    "tone_style_2 = \"清凉舒爽\"\n",
    "result_2 = generate_rednote(product_name_2, tone_style_2)\n",
    "\n",
    "print(\"\\n--- 生成的文案 2 ---\")\n",
    "print(result_2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "id": "ab29ce6a",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      "🚀 启动小红书文案生成助手，产品：鼓浪屿旅游，风格：美景美食享受生活\n",
      "\n",
      "-- Iteration 1 --\n",
      "Agent: 决定调用工具...\n",
      "Agent Action: 调用工具 'generate_emoji'，参数：{'context': '鼓浪屿旅游 美景美食 享受生活'}\n",
      "[Tool Call] 模拟生成表情符号，上下文：鼓浪屿旅游 美景美食 享受生活\n",
      "Observation: 工具返回结果：['✨', '💖', '💧']\n",
      "-- Iteration 2 --\n",
      "Agent: 决定调用工具...\n",
      "Agent Action: 调用工具 'search_web'，参数：{'query': '鼓浪屿旅游 美景 美食 小红书'}\n",
      "[Tool Call] 模拟搜索网页：鼓浪屿旅游 美景 美食 小红书\n",
      "Observation: 工具返回结果：未找到关于 '鼓浪屿旅游 美景 美食 小红书' 的特定信息，但市场反馈通常关注产品成分、功效和用户体验。\n",
      "-- Iteration 3 --\n",
      "[模型生成结果] ```json\n",
      "{\n",
      "  \"title\": \"✨鼓浪屿慢生活｜漫步琴岛，邂逅最美的海与时光💖\",\n",
      "  \"body\": \"终于打卡了心心念念的鼓浪屿！这座小岛真的太治愈了～🌊\\n\\n漫步在石板路上，两旁的欧式建筑和绿植交织，仿佛穿越到了欧洲小镇。随手一拍都是大片，姐妹们一定要穿上美美的裙子来！👗\\n\\n美食推荐：\\n1️⃣ 张三疯奶茶：招牌奶茶超好喝，奶香浓郁不腻～\\n2️⃣ 叶氏麻糍：软糯香甜，一口下去幸福感爆棚！\\n3️⃣ 龙头路小吃街：海蛎煎、沙茶面、土笋冻…吃货的天堂！\\n\\nTips：\\n- 建议早上登岛，避开人流高峰。\\n- 穿舒适的鞋子，岛上全靠步行哦～\\n\\n鼓浪屿的每一处角落都藏着惊喜，快来和我一起感受这份慢生活的美好吧！💖\",\n",
      "  \"hashtags\": [\"#鼓浪屿旅游\", \"#厦门美食\", \"#慢生活\", \"#旅行打卡\", \"#海岛度假\"],\n",
      "  \"emojis\": [\"✨\", \"💖\", \"🌊\", \"👗\", \"💧\"]\n",
      "}\n",
      "```\n",
      "Agent: 任务完成，成功解析最终JSON文案。\n",
      "\n",
      "--- 生成的文案 2 ---\n",
      "{\n",
      "  \"title\": \"✨鼓浪屿慢生活｜漫步琴岛，邂逅最美的海与时光💖\",\n",
      "  \"body\": \"终于打卡了心心念念的鼓浪屿！这座小岛真的太治愈了～🌊\\n\\n漫步在石板路上，两旁的欧式建筑和绿植交织，仿佛穿越到了欧洲小镇。随手一拍都是大片，姐妹们一定要穿上美美的裙子来！👗\\n\\n美食推荐：\\n1️⃣ 张三疯奶茶：招牌奶茶超好喝，奶香浓郁不腻～\\n2️⃣ 叶氏麻糍：软糯香甜，一口下去幸福感爆棚！\\n3️⃣ 龙头路小吃街：海蛎煎、沙茶面、土笋冻…吃货的天堂！\\n\\nTips：\\n- 建议早上登岛，避开人流高峰。\\n- 穿舒适的鞋子，岛上全靠步行哦～\\n\\n鼓浪屿的每一处角落都藏着惊喜，快来和我一起感受这份慢生活的美好吧！💖\",\n",
      "  \"hashtags\": [\n",
      "    \"#鼓浪屿旅游\",\n",
      "    \"#厦门美食\",\n",
      "    \"#慢生活\",\n",
      "    \"#旅行打卡\",\n",
      "    \"#海岛度假\"\n",
      "  ],\n",
      "  \"emojis\": [\n",
      "    \"✨\",\n",
      "    \"💖\",\n",
      "    \"🌊\",\n",
      "    \"👗\",\n",
      "    \"💧\"\n",
      "  ]\n",
      "}\n"
     ]
    }
   ],
   "source": [
    "# 产品案例 2: 鼓浪屿旅游\n",
    "product_name_2 = \"鼓浪屿旅游\"\n",
    "tone_style_2 = \"美景美食享受生活\"\n",
    "result_2 = generate_rednote(product_name_2, tone_style_2)\n",
    "\n",
    "print(\"\\n--- 生成的文案 2 ---\")\n",
    "print(result_2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "id": "fdc393ee",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      "🚀 启动小红书文案生成助手，产品：书法专班，风格：名师，效果突出\n",
      "\n",
      "-- Iteration 1 --\n",
      "Agent: 决定调用工具...\n",
      "Agent Action: 调用工具 'query_product_database'，参数：{'product_name': '书法专班'}\n",
      "[Tool Call] 模拟查询产品数据库：书法专班\n",
      "Observation: 工具返回结果：产品数据库中未找到关于 '书法专班' 的详细信息。\n",
      "-- Iteration 2 --\n",
      "Agent: 决定调用工具...\n",
      "Agent Action: 调用工具 'search_web'，参数：{'query': '书法专班 课程特色 用户评价'}\n",
      "[Tool Call] 模拟搜索网页：书法专班 课程特色 用户评价\n",
      "Observation: 工具返回结果：未找到关于 '书法专班 课程特色 用户评价' 的特定信息，但市场反馈通常关注产品成分、功效和用户体验。\n",
      "-- Iteration 3 --\n",
      "Agent: 决定调用工具...\n",
      "Agent Action: 调用工具 'generate_emoji'，参数：{'context': '书法学习 名师指导 效果突出'}\n",
      "[Tool Call] 模拟生成表情符号，上下文：书法学习 名师指导 效果突出\n",
      "Observation: 工具返回结果：['💖', '👍', '💧']\n",
      "-- Iteration 4 --\n",
      "[模型生成结果] ```json\n",
      "{\n",
      "  \"title\": \"【书法专班】名师亲授，30天写出大师级字体！✨\",\n",
      "  \"body\": \"终于找到一款真正能提升书法的课程了！🎉\\n\\n📖 课程亮点：\\n1️⃣ 名师一对一指导，纠正每一个笔画细节\\n2️⃣ 30天系统训练，从基础到进阶全面提升\\n3️⃣ 专属练习册+视频教程，随时随地学习\\n\\n💯 效果实测：\\n学员反馈：一个月后字迹明显工整，连签名都高级感满满！\\n\\n🔥 适合人群：\\n- 想提升字迹的学生党\\n- 职场人士需要专业签名\\n- 书法爱好者进阶学习\\n\\n现在报名还送精美文房四宝一套！速速行动吧～\\n\\n#书法学习 #名师指导 #字迹提升 #职场必备 #文房四宝\",\n",
      "  \"hashtags\": [\"#书法学习\", \"#名师指导\", \"#字迹提升\", \"#职场必备\", \"#文房四宝\"],\n",
      "  \"emojis\": [\"✨\", \"🎉\", \"📖\", \"💯\", \"🔥\"]\n",
      "}\n",
      "```\n",
      "Agent: 任务完成，成功解析最终JSON文案。\n",
      "\n",
      "--- 生成的文案 2 ---\n",
      "{\n",
      "  \"title\": \"【书法专班】名师亲授，30天写出大师级字体！✨\",\n",
      "  \"body\": \"终于找到一款真正能提升书法的课程了！🎉\\n\\n📖 课程亮点：\\n1️⃣ 名师一对一指导，纠正每一个笔画细节\\n2️⃣ 30天系统训练，从基础到进阶全面提升\\n3️⃣ 专属练习册+视频教程，随时随地学习\\n\\n💯 效果实测：\\n学员反馈：一个月后字迹明显工整，连签名都高级感满满！\\n\\n🔥 适合人群：\\n- 想提升字迹的学生党\\n- 职场人士需要专业签名\\n- 书法爱好者进阶学习\\n\\n现在报名还送精美文房四宝一套！速速行动吧～\\n\\n#书法学习 #名师指导 #字迹提升 #职场必备 #文房四宝\",\n",
      "  \"hashtags\": [\n",
      "    \"#书法学习\",\n",
      "    \"#名师指导\",\n",
      "    \"#字迹提升\",\n",
      "    \"#职场必备\",\n",
      "    \"#文房四宝\"\n",
      "  ],\n",
      "  \"emojis\": [\n",
      "    \"✨\",\n",
      "    \"🎉\",\n",
      "    \"📖\",\n",
      "    \"💯\",\n",
      "    \"🔥\"\n",
      "  ]\n",
      "}\n"
     ]
    }
   ],
   "source": [
    "# 产品案例 3: 书法培训\n",
    "product_name_2 = \"书法专班\"\n",
    "tone_style_2 = \"名师，效果突出\"\n",
    "result_2 = generate_rednote(product_name_2, tone_style_2)\n",
    "\n",
    "print(\"\\n--- 生成的文案 2 ---\")\n",
    "print(result_2)"
   ]
  },
  {
   "attachments": {},
   "cell_type": "markdown",
   "id": "687592e7",
   "metadata": {},
   "source": [
    "## 6. 评估与优化\n",
    "\n",
    "文案生成并非一蹴而就，需要持续的评估和优化。本节讨论一些评估方法和优化策略。\n",
    "\n",
    "#### 评估文案质量：\n",
    "*   **客观量化评估 (数据)：**\n",
    "    *   **点赞/收藏/评论/分享：** 基础互动\n",
    "    *   **曝光/阅读/点击/涨粉：：** 流量与曝光\n",
    "    *   **停留时长/截图率：** 用户行为。\n",
    "    *   **商品页浏览/加购/ROI/成交转化：** 商业价值\n",
    "    *   **爆文率/同类横向对比：** 竞争对比\n",
    "*   **主观内部评估 (人工)：**\n",
    "    *   **相关性：** 是否符合产品特点和主题。\n",
    "    *   **吸引力：** 标题是否抓人，内容是否流畅。\n",
    "    *   **合规性：** 是否有敏感词、违规宣传。\n",
    "    *   **风格匹配：** 是否符合小红书调性和指定语气。\n",
    "    *   **用户画像：** 目标人群年龄、地域、兴趣标签。\n",
    "\n",
    "\n",
    "\n",
    "#### 优化迭代方法：\n",
    "*   **Prompt 调整：** 根据评估结果，精修 System Prompt、User Prompt，增加或修改 Few-shot 示例。\n",
    "*   **工具扩充：** 引入新的工具（如敏感词检测工具、竞品分析工具）。\n",
    "*   **RAG (检索增强生成)：** 结合更精准的内部知识库，减少幻觉。\n"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "b4faff3b",
   "metadata": {},
   "source": [
    "## 7. 总结与展望\n",
    "\n",
    "通过本次实战，我们成功构建了一个基于 DeepSeek Agent 的小红书爆款文案生成助手。我们学习了如何拆解需求、设计 Prompt、定义工具，并实现 Agent 的核心工作流。\n",
    "\n",
    "Agent 在内容营销领域的潜力巨大，未来可以进一步拓展到：\n",
    "\n",
    "*   **超个性化内容：** 根据用户数据，生成一对一的定制文案。\n",
    "*   **多模态内容创作：** 结合图片、视频生成，实现图文音视频一体化。\n",
    "*   **智能营销决策：** Agent 不仅生成内容，还能分析效果并给出投放建议。\n",
    "*   **跨平台适配：** 快速生成适应不同社交媒体平台风格的文案。\n",
    "\n",
    "同时，我们也需关注挑战，如确保内容真实性、处理高度主观情感、与现有工作流的无缝集成等。Agent 技术仍在快速发展，期待未来能带来更多惊喜！"
   ]
  }
 ],
 "metadata": {
  "colab": {
   "private_outputs": true,
   "provenance": []
  },
  "kernelspec": {
   "display_name": "deepseek",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.13.5"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
